<!--
 * @Author: Bonnie
 * @Date: 2021-12-23 15:58:31
 * @LastEditTime: 2021-12-23 16:04:20
 * @LastEditors: Bonnie
 * @Description: and的简写
 * @FilePath: /public_demo/src/views/JsSkill/page3.vue
-->
<template>
  <div>
    <h2>AND的简写</h2>
    <p>考虑一个具有布尔值和函数的情况</p>
    <article>
      <pre>
            <code>
let isPlay = false;

function action() {
    console.log("log");
}

if( isPlay ){
    action()
}
            </code>
        </pre>
    </article>
    <p class='mt10'>上述代码看起来已经够简洁了，但是还有更简洁的方式</p>
    <article>
        <pre>
            <code>
let isPlay = false;

function action() {
    console.log("log");
}

isPlay && action();
            </code>
        </pre>
    </article>
  </div>
</template>
<script>
export default {
  name: "page3",
  data() {
    return {};
  }
};
</script>
<style lang='scss' scoped>
</style>